Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Replace AST with CST #2213

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

[WIP] Replace AST with CST #2213

wants to merge 1 commit into from

Conversation

gpetiot
Copy link
Collaborator

@gpetiot gpetiot commented Dec 6, 2022

Please don't merge this!
The purpose is to visualize the diff between the current state of the ast+parser of ocamlformat and the cst+parser of ocamlformat-ng prototype (https://github.com/tarides/ocamlformat-ng), the files in this branch have been made closer to the current main branch of ocamlformat, but this doesn't build.

To display the diff: git diff main cst -- vendor/parser-extended/

This is a suggestion of roadmap (non-exhaustive) of the changes left to report in ocamlformat, it should be easier to start with the type changes before working on the ext_attributes and the parentheses. Refer to parsetree.mli:

1. Enrich existing type constructors

2. Improve representation of poly/newtype

3. Add location in Longident.t type

  • replace occurrences ofLongident.t. loc with Longident.t

4. Add extension and attributes

5. Preserve parentheses

  • Pexp_parens
  • Ppat_parens
  • Ptyp_parens
  • Pcl_parens
  • Pmty_parens
  • Pmod_parens

Bonus

  • types module_expr and module_type probably need to be reworked too
  • undo the work made in Sugar.ml by reverting the normalization made in the parser

While reporting some of the changes into ocamlformat, if design choices make the files diverge from ocamlformat-ng please update the files in this branch.
Also don't forget to propagate the changes in parser-recovery/lib/parser.mly and run dune build @all to regenerate the diffs.

@Julow
Copy link
Collaborator

Julow commented Jul 17, 2023

I've started working on the poly/newtype/annotation/coercion on let bindings (on this branch: https://github.com/Julow/ocamlformat/tree/concrete_let_bindings), which I'm putting on hold until #2401 is backported as it is largely conflicting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants